package com.cmwa.solution.utils.spring;

import java.io.IOException;
import java.util.Date;

import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;

import com.cmwa.solution.utils.DateUtils;

/**
 * Description: 日期转换 - "yyyy-MM-dd" 
 */
public class DateYMDJsonSerializer extends JsonSerializer<Date> {
	@Override
	public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
		jsonGenerator.writeString(DateUtils.formatDate(date, DateUtils.DATE_FORMAT_yMd_EN));
	}
}